package cn.hk.empchange.controller;

import cn.HK.po.Emp;
import cn.HK.vo.SystemResult;
import cn.hk.empchange.service.ChangeEmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/emp")
public class ChangeEmpController {
    @Autowired
    private ChangeEmpService changeEmpService;

    @RequestMapping(value = "/change")
    public SystemResult ChangeEmp(Emp emp, String newePassword) {
        if (changeEmpService.ChangeEmp(emp, newePassword)){
            return SystemResult.ok();
        } else {
            return SystemResult.build
                    (201, "用户信息修改失败", null);
        }
    }
}

